package edu.unf.cen6940.converter;

import java.text.ParseException;
import java.util.Locale;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.Formatter;
import org.springframework.stereotype.Component;

import edu.unf.cen6940.dao.StudentDAO;
import edu.unf.cen6940.domain.Student;
import edu.unf.cen6940.service.StudentService;

@Component
public class StudentConverter implements Formatter<Student> {

	@Autowired
	StudentService studentService;
	
	@Autowired
	StudentDAO studentDAO;
	
	@Override
	public String print(Student arg0, Locale arg1) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Student parse(String arg0, Locale arg1) throws ParseException {
		int id = Integer.parseInt(arg0);
		Student student = studentDAO.findStudentByStudentId(id);
		return student;
	}

}
